﻿using Model.Sys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DAGG.Controllers
{
    public class BaseController : Controller
    {
        

        #region 获取登录用户信息
        protected SysUserModel GetUserInfo()
        {
            SysUserModel sysUserModel = (SysUserModel)Session["SysUser"];
             
            if (sysUserModel != null && sysUserModel.ID != 0)
            {
                return sysUserModel;
            }
            else
            {
                return null;
            }
        }
        #endregion



        #region 过滤信息
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (Session["SysUser"] == null) //检查用户是否有登录
            {
                ContentResult r = new ContentResult();
                r.Content = " <script> if(confirm('登录超时，是否重新登录？')){window.parent.parent.parent.location = '/Login/Index';} </script>";
                filterContext.Result = r;
            }
            
            base.OnActionExecuting(filterContext);
        }
        #endregion

	}
}


